package com.phone.exception;

/**
 * Created by tisen on 2017/8/3.
 */
public class TokenException extends Exception {
    public static final int TOKEN_IS_EMPTY = 0;
    public static final int TOKEN_NOT_EXIST = 1;
    public static final int TOKEN_TIMEOUT = 2;

    private int error_code;
    private String error_message = "token error";


    public TokenException(int type) {
        error_code = type;
        switch (type) {
            case TOKEN_IS_EMPTY:
                error_message = "token is empty";
                break;
            case TOKEN_NOT_EXIST:
                error_message = "token is not exist";
                break;
            case TOKEN_TIMEOUT:
                error_message = "token is timeout";
                break;
            default:
                break;
        }
    }

    public int getError_code() {
        return error_code;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getError_message() {
        return error_message;
    }

    public void setError_message(String error_message) {
        this.error_message = error_message;
    }

    @Override
    public String getMessage() {
        return error_message;
    }

}
